<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">-->
    <title>linejoin</title>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
    function draw() {
        var ctx = document.getElementById('canvas').getContext('2d');
        var lineJoin = ['round', 'bevel', 'miter'];
        //默认miter。两线段连接处，锐角
        //bevel，两线段连接处，切边
        //round，两线段连接处，椭圆
        ctx.lineWidth = 10;
        for (var i = 0; i < lineJoin.length; i++) {
            ctx.lineJoin = lineJoin[i];
            ctx.beginPath();
            ctx.moveTo(-5, 5 + i * 40);
            ctx.lineTo(35, 45 + i * 40);
            ctx.lineTo(75, 5 + i * 40);
            ctx.lineTo(115, 45 + i * 40);
            ctx.lineTo(155, 5 + i * 40);
            ctx.stroke();
        }
    }

    draw();
</script>
</body>
</html>